﻿using GalaSoft.MvvmLight.Messaging;
using System.Windows;
using System.Windows.Controls;

namespace TransControlSystem.View.Common
{
    /// <summary>
    /// UserManagementWindow.xaml 的交互逻辑
    /// </summary>
    public partial class UserManagementWindow : Window
    {
        public UserManagementWindow()
        {
            InitializeComponent();
            Messenger.Default.Register<NotificationMessage>(this, (nm) =>
            {
                if (nm.Notification == "HideUserManagementWindow")
                {
                    if (nm.Sender == DataContext)
                        Hide();
                }
            });
        }
        private void dg_taskList_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
            if (e.Column.Header.ToString() == "Id" ||
                e.Column.Header.ToString() == "UserName" ||
                e.Column.Header.ToString() == "Password" ||
                e.Column.Header.ToString() == "RoleName" ||
                e.Column.Header.ToString() == "Account" ||
                e.Column.Header.ToString() == "Role"
              )
            {
                e.Cancel = true;
            }
        }

        private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            e.Row.Header = e.Row.GetIndex() + 1;
        }
    }
}
